<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,user-scalable=no,minimal-ui">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../img/asset-favico.ico">
    <title>会员中心</title>
    <link rel="stylesheet" href="../css/page-health-login.css"/>
    <link rel="stylesheet" href="../plugins/elementui/index.css"/>
    <script src="../plugins/jquery/dist/jquery.min.js"></script>
    <script src="../plugins/healthmobile.js"></script>
    <script src="../plugins/datapicker/datePicker.js"></script>
    <script src="../plugins/vue/vue.js"></script>
    <script src="../plugins/vue/axios-0.18.0.js"></script>
    <script src="../plugins/elementui/index.js"></script>
</head>
<body data-spy="scroll" data-target="#myNavbar" data-offset="150">
<div class="app" id="app">
    <!-- 页面头部 -->
    <div class="top-header">
        <span class="f-left"><i class="icon-back"></i></span>
        <span class="center">传智健康</span>
        <span class="f-right"><i class="icon-more"></i></span>
    </div>
    <div style="margin-left: 20px">信息详情</div>
    <div class="contentBox">
        <div class="userInfo">
            <form id='userInfo-form' :model="userInfo">
                <div class="input-row">
                    <label>用户名</label> &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp <input v-model="userInfo.name"
                                                                                        id='name' type="text"
                                                                                        placeholder="未设置"><br><br>
                    <label>性别</label> &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp <input v-model="userInfo.sex"
                                                                                       type="radio" name="sex"
                                                                                       value="1">男<input
                        v-model="userInfo.sex" name="sex" type="radio" value="2">女<br><br>
                    <label>手机号</label> &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp <input v-model="userInfo.phoneNumber"
                                                                                        id='phoneNumber' type="text"
                                                                                        placeholder="未设置"><br><br>
                    <label>身份证号码</label> &nbsp&nbsp <input v-model="userInfo.idCard" id='idCard' type="text"
                                                           placeholder="未设置"><br><br>
                    <label>邮箱</label> &nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input
                        v-model="userInfo.email" id='email' type="text" placeholder="未设置"><br><br>
                    <label>生日</label> &nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input
                        v-model="userInfo.birthday" id='birthday' type="text" placeholder="未设置"><br><br>
                    <label>注册日期</label> <i class="icon-date" class="picktime"></i>
                    <input v-model="userInfo.regTime" type="text" class="picktime" readonly>
                </div>
                <br>
                修改信息请点击下方修改
                <div class="btn yes-btn"><a @click="login()" href="#">修改个人信息</a></div>
            </form>
        </div>
    </div>
</div>
<script>
    var vue = new Vue({
            el: '#app',
            data: {
                userInfo:{}
            },

            methods: {
                handleCookie() {
                    //取cookie,用于找出当前登录的用户号码
                    var telephone = getCookie('member_login_telephone'); //cookie赋值给变量。
                    if (telephone == null) {
                        this.$confirm('Cookie已失效,请重新登录!','提示',{
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(() => {
                            window.location.href="login.html";
                            }).catch(() => {
                            window.location.href="login.html";
                        });
                    } else {
                        //从Redis中获取会员信息,若存在,则不需登录,否则仍需重新登录
                        axios.get("/member/getMemberInRedis.do?telephone=" + telephone).then((res) => {
                            if (res.data.flag) {
                                this.userInfo = res.data.data;
                            } else {
                                this.$confirm('登录信息已失效,请重新登录!','提示',{
                                    confirmButtonText: '确定',
                                    cancelButtonText: '取消',
                                    type: 'warning'
                                }).then(() => {
                                    window.location.href="login.html";
                                }).catch(() => {
                                    window.location.href="login.html";
                                });
                            }
                        });
                    }
                }

            },
        mounted() {
                this.handleCookie();
        }

    })
</script>
<script>
    //日期控件
    var calendar = new datePicker();
    calendar.init({
        'trigger': '.picktime',/*按钮选择器，用于触发弹出插件*/
        'type': 'date',/*模式：date日期；datetime日期时间；time时间；ym年月；*/
        'minDate': getSpecifiedDate(new Date(), 1),/*最小日期*/
        'maxDate': getSpecifiedDate(new Date(), 30),/*最大日期*/
        'onSubmit': function () { /*确认时触发事件*/
            //var theSelectData = calendar.value;
        },
        'onClose': function () { /*取消时触发事件*/
        }
    });
</script>
</body>
</html>